package net.destroyer.game.tetris.gui.menu;

import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import java.util.Observer;

import javax.swing.JMenuBar;

import net.destroyer.game.tetris.gui.MainWindow;
import net.destroyer.game.tetris.gui.State;
import net.destroyer.game.tetris.gui.menu.interf.IUpdate;

public class Menubar extends JMenuBar implements Observer{

	private static final long serialVersionUID = 910282057072016020L;
	private State status;
	private List<IUpdate> upd;
	public Menubar(MainWindow w) {
		this.upd = new ArrayList<IUpdate>();
		this.status = w.getStatus();
		GameMenu game = new GameMenu(w);
		this.add(game);
		this.upd.add(game);
		update(null, null);
	}
	@Override
	public void update(Observable o, Object arg) {
		for (IUpdate e : upd) {
			e.update(status);
		}
	}
}
